package day6;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @author oldliu
 * @since 1.0
 */
public class CalTest2 {
    public static void main(String[] args) {
        SimpleDateFormat df=new SimpleDateFormat("yyyy年MM月dd日 hh时mm分ss秒 E");

        Calendar c=Calendar.getInstance();
        System.out.println(c);
        Date time = c.getTime();
        System.out.println("Date:"+time);
        //月份不涨
        c.roll(Calendar.DAY_OF_MONTH,100);
        System.out.println("加了100");
        System.out.println(c.getTime());
        System.out.println(df.format(c.getTime()));

        c.set(c.get(Calendar.YEAR),Calendar.OCTOBER,1);
        System.out.println(c.getTime());
        //df.applyPattern("");
        //Date ->String
        //String ->date
        String ds = df.format(c.getTime());
        System.out.println("转换后："+ds);
    }
}
